package com.mxp.elm.utils;

/**
 * @author mxp
 * @date 2023/2/23 11:46
 */
public class R {

    private final int code;
    private final String msg;
    private Object data;

    public R(int code, String msg, Object data) {
        this(code, msg);
        this.data = data;
    }

    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static R ok() {
        return new R(0, "OK");
    }

    public static R ok(Object data) {
        return new R(0, "OK", data);
    }

    public static R error(String msg) {
        return new R(4444, msg);
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() {
        return data;
    }
}
